﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.原型模式
{
    public class PrototypePatternDemo
    {
        public static void Test()
        {
            ShapeCache.LoadCache();

            Shape cloneShape1 = ShapeCache.GetShape("1");
            cloneShape1.Draw();
            Console.WriteLine($"Shape:{cloneShape1.Type}");

            Shape cloneShape2 = ShapeCache.GetShape("2");
            cloneShape2.Draw();
            Console.WriteLine($"Shape:{cloneShape2.Type}");

            Shape cloneShape3 = ShapeCache.GetShape("3");
            cloneShape3.Draw();
            Console.WriteLine($"Shape:{cloneShape3.Type}");

            Console.WriteLine($"cloneShape1 == cloneShape2:{cloneShape1 == cloneShape2}");
            Console.WriteLine($"cloneShape1 == cloneShape3:{cloneShape1 == cloneShape3}");
            Console.WriteLine($"cloneShape2 == cloneShape3:{cloneShape2 == cloneShape3}");

        }
    }
}
